package LinkedList.删除重复元素_留一个;

import LinkedList.ListNode;

public class Test {

    public ListNode deleteDuplicates(ListNode head) {

        ListNode cur = head;

        while(cur != null && cur.next != null) {

            if(cur.val == cur.next.val) {
                cur.next = cur.next.next;
            }else {
                cur = cur.next;
            }
        }

        return head;
    }
}
